package com.xl333.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * 时间工具类
 * @Date 2018/12/19
 * @Author danger
 */
public class TimeDateUtil {

    public static final String PATTERN_yyyyMMdd = "yyyy/MM/dd";

    /**
     * 获取当前时间的秒值
     * @return
     */
    public static int getCurrentTimeSecond(){
        return (int)(System.currentTimeMillis()/1000);
    }

    public static String toInteger(long time, String pattern){
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(time);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
        return simpleDateFormat.format(calendar.getTime());
    }

}
